﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CodeGenerate;
using System.IO;
using CodeGenerate.Data;
using CodeGenerate.TemplateEngine;
using System.Data;
using CodeGenerate.ServiceReference;

namespace CodeGenerate
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("start...");
            Table table = new Table();
            table.Name = "Sys_Department";
            table.Description = "部门";

            DataBaseClient s = new DataBaseClient();
          
            //DataBaseService s = new DataBaseService();
            //s.GetViewColumns("View_User");

            //Column[] columns = s.GetViewColumns("View_User").ToArray();
            //for (int i = 0; i < columns.Count(); i++)
            //{
            //    Console.WriteLine(columns[i].Name);
            //}

             // Console.WriteLine(c.CreateAspxCsInfo(table, columns));
          

            //using (StreamReader sr = new StreamReader(Environment.CurrentDirectory+@"\Template\CmdObject.txt", Encoding.Default))
            //{
            //    Console.WriteLine(sr.ReadToEnd());
            //}

           // Console.WriteLine("//////////////////////////////////");

          
           // List<Column> columns = service.GetColumns("Sys_Department");
            //foreach (Column c in columns)
            //{
            //    Console.WriteLine(c.Name);
            //}


            //List<Table> tables = Utils.GetObjects(ObjectType.StoredProcedure);

           

            //DataBaseService service = new DataBaseService();
            //Console.WriteLine(service.CreateAspxList(table,service.GetColumns(table.Name)));

            //TemplateManager tm = TemplateManager.FromFile(Environment.CurrentDirectory + @"\Template\aspxcsEdit.txt");
            //tm.SetValue("table", table);
            //tm.SetValue("columns", columns);
            //string result = tm.Process();
            //using (StreamWriter sw = new StreamWriter(@"c:\11111.txt", false, Encoding.Default))
            //{
            //    sw.Write(result);
            //}
            //Console.WriteLine(result);

            
            
        }
    }
}
